home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2002 November / SGI IRIX Base Documentation 2002 November.iso / usr / share / catman / p_man / cat3 / il / ilSepSharpenKernel.z / ilSepSharpenKernel
Encoding:
Text File  |  2002-10-03  |  10.4 KB  |  265 lines

  1.  
  2.  
  3.  
  4. iiiillllSSSSeeeeppppSSSShhhhaaaarrrrppppeeeennnnKKKKeeeerrrrnnnneeeellll((((3333))))                 IIIImmmmaaaaggggeeeeVVVViiiissssiiiioooonnnn LLLLiiiibbbbrrrraaaarrrryyyy CCCC++++++++ RRRReeeeffffeeeerrrreeeennnncccceeee MMMMaaaannnnuuuuaaaallll
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      iiiillllSSSSeeeeppppSSSShhhhaaaarrrrppppeeeennnnKKKKeeeerrrrnnnneeeellll - a separable kernel to do image sharpening (and
  10.      blurring)
  11.  
  12. IIIINNNNHHHHEEEERRRRIIIITTTTSSSS FFFFRRRROOOOMMMM
  13.      ilSepKernel
  14.  
  15. HHHHEEEEAAAADDDDEEEERRRR FFFFIIIILLLLEEEE
  16.      #include <il/ilSepSharpenKernel.h>
  17.  
  18. CCCCLLLLAAAASSSSSSSS DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  19.      This class implements a separable 2D gaussian shaped image sharpening (or
  20.      blurring  kernel).  The x and y filter weights are detemined by the
  21.      formula:
  22.  
  23.                      2           2        2
  24.                 -( dx / (2 * sigma * radius ) )
  25.               e
  26.  
  27.      where:
  28.  
  29.               sigma = radius*2 * -sharpness / 3
  30.               dx = distance from center of kernel
  31.  
  32.  
  33.      This creates a circularly symmetric, Gaussian shapped kernel.  The filter
  34.      weights are then normalized to produce an output that computes:
  35.  
  36.               (1+sharpness)*I - sharpness*G
  37.  
  38.      where I is the original image G is the orignal image with the gausing
  39.      kernel applied.
  40.  
  41.      Because of the separable nature of the kernel, the negative weights
  42.      cancel out on the corners of the kernel producing often undesirable
  43.      ringing in the filtered result; this can be avoided by using
  44.      ilSharpenKernel instead.  This is only a problem when sharpening, for
  45.      blurring the result is mathematically equivalent to the non-separable
  46.      kernel and much faster.
  47.  
  48.      Here are some example kernels with the default sharpness factor, 0.5, for
  49.      various radii:
  50.  
  51.      -.0054   1.0109   -.0054      -.0033   -.0971   1.2009   -.0971   -.0033
  52.  
  53.             rrrraaaaddddiiiiuuuussss ==== 1111                             rrrraaaaddddiiiiuuuussss ==== 2222
  54.  
  55.      The default kernel is:
  56.  
  57.                              -.0533   1.1065   -.0533
  58.  
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. iiiillllSSSSeeeeppppSSSShhhhaaaarrrrppppeeeennnnKKKKeeeerrrrnnnneeeellll((((3333))))                 IIIImmmmaaaaggggeeeeVVVViiiissssiiiioooonnnn LLLLiiiibbbbrrrraaaarrrryyyy CCCC++++++++ RRRReeeeffffeeeerrrreeeennnncccceeee MMMMaaaannnnuuuuaaaallll
  71.  
  72.  
  73.  
  74.  
  75.                                    rrrraaaaddddiiiiuuuussss ==== 1111....5555
  76.      The kernel weights always sum to one and the clamping attribute is set on
  77.      this kernel so no change in the input range of values will be effected by
  78.      the application of this kernel.
  79.  
  80. CCCCLLLLAAAASSSSSSSS MMMMEEEEMMMMBBBBEEEERRRR FFFFUUUUNNNNCCCCTTTTIIIIOOOONNNN SSSSUUUUMMMMMMMMAAAARRRRYYYY
  81.      CCCCoooonnnnssssttttrrrruuuuccccttttoooorrrr
  82.  
  83.           ilSepSharpenKernel(float sharpness=.5, float radius=1.5)
  84.  
  85.      GGGGeeeetttt aaaannnndddd sssseeeetttt sssshhhhaaaarrrrppppeeeennnniiiinnnngggg ppppaaaarrrraaaammmmeeeetttteeeerrrrssss
  86.  
  87.           void setSharpness(float val)
  88.           void setRadius(float val)
  89.           float getSharpness()
  90.           float getRadius()
  91.  
  92.  
  93. FFFFUUUUNNNNCCCCTTTTIIIIOOOONNNN DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNNSSSS
  94.      iiiillllSSSSeeeeppppSSSShhhhaaaarrrrppppeeeennnnKKKKeeeerrrrnnnneeeellll(((())))
  95.  
  96.           ilSepSharpenKernel(float sharpness=.5, float radius=1.5)
  97.  
  98.  
  99.           Creates a separable kernel with the specified _s_h_a_r_p_n_e_s_s and _r_a_d_i_u_s.
  100.           The sharpness typically ranges from -1 for maximum blur, to 0 for no
  101.           effect, to positive values up to about 10 for various degrees of
  102.           sharpening.  The radius can be any non-negative value.  A radius of
  103.           zero will perform no filtering, while successively larger values
  104.           will filter lower and lower frequencies.  The actual kernel size is
  105.           determined by the formula:
  106.  
  107.               width,height = 1 + 2*(int)radius
  108.  
  109.  
  110.           Thus, a radius of 1.5 (the default) will create a 3x3 kernel.
  111.  
  112.      ggggeeeettttRRRRaaaaddddiiiiuuuussss(((())))
  113.  
  114.           float getRadius()
  115.  
  116.  
  117.           This method returns the current radius of the filter as set by the
  118.           constructor or the last call to sssseeeettttRRRRaaaaddddiiiiuuuussss().
  119.  
  120.      ggggeeeettttSSSShhhhaaaarrrrppppnnnneeeessssssss(((())))
  121.  
  122.           float getSharpness()
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. iiiillllSSSSeeeeppppSSSShhhhaaaarrrrppppeeeennnnKKKKeeeerrrrnnnneeeellll((((3333))))                 IIIImmmmaaaaggggeeeeVVVViiiissssiiiioooonnnn LLLLiiiibbbbrrrraaaarrrryyyy CCCC++++++++ RRRReeeeffffeeeerrrreeeennnncccceeee MMMMaaaannnnuuuuaaaallll
  137.  
  138.  
  139.  
  140.           This method returns the current sharpness of the filter as set by
  141.           the constructor or the last call to sssseeeettttSSSShhhhaaaarrrrppppnnnneeeessssssss().
  142.  
  143.      ggggeeeettttSSSSiiiiggggmmmmaaaa(((())))
  144.  
  145.           float getSigma()
  146.  
  147.  
  148.           This method returns the sigma value used in generating the kernel
  149.           (see the equation above).
  150.  
  151.      sssseeeettttRRRRaaaaddddiiiiuuuussss(((())))
  152.  
  153.           void setRadius(float val)
  154.  
  155.  
  156.           This method sets the radius of the kernel to _v_a_l.  The radius can be
  157.           any non-negative value. A radius of zero will perform no filtering,
  158.           while successively larger values will filter lower and lower
  159.           frequencies.  The actual kernel size is determined by the formula:
  160.  
  161.               width,height = 1 + 2*(int)radius
  162.  
  163.  
  164.           If any objects are watching this kernel (see iiiillllWWWWaaaattttcccchhhheeeeddddOOOObbbbjjjjeeeecccctttt(3))
  165.           then they will be notified that the kernel has changed when this
  166.           method is called.
  167.  
  168.      sssseeeettttSSSShhhhaaaarrrrppppnnnneeeessssssss(((())))
  169.  
  170.           void setSharpness(float val)
  171.  
  172.  
  173.           This method sets the sharpness of the kernel to _v_a_l.  The effect of
  174.           the sharpness value falls into three ranges: positve, between 0 and
  175.           -1, and less than -1.  As the value increases from zero the result
  176.           is a progressively more sharpended image, typically values from 0-10
  177.           are used. Values larger than about 2 produce a fairly extreme
  178.           sharpening effect.  As the value decreases from zero going to -1 the
  179.           result is a progressively more blurry image.  Values less than -1
  180.           produce a weird effect that becomes progressively sharper; this
  181.           range is not normally used.
  182.  
  183.           If any objects are watching this kernel (see iiiillllWWWWaaaattttcccchhhheeeeddddOOOObbbbjjjjeeeecccctttt(3))
  184.           then they will be notified that the kernel has changed when this
  185.           method is called.
  186.  
  187.      sssseeeettttSSSSiiiiggggmmmmaaaa(((())))
  188.  
  189.           void setSigma(float val)
  190.  
  191.  
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202. iiiillllSSSSeeeeppppSSSShhhhaaaarrrrppppeeeennnnKKKKeeeerrrrnnnneeeellll((((3333))))                 IIIImmmmaaaaggggeeeeVVVViiiissssiiiioooonnnn LLLLiiiibbbbrrrraaaarrrryyyy CCCC++++++++ RRRReeeeffffeeeerrrreeeennnncccceeee MMMMaaaannnnuuuuaaaallll
  203.  
  204.  
  205.  
  206.           This method sets the sigma value used in generating the kernel (see
  207.           the equation above).  The default value is 1/3.  The useful range is
  208.           from zero to one.
  209.  
  210. IIIINNNNHHHHEEEERRRRIIIITTTTEEEEDDDD MMMMEEEEMMMMBBBBEEEERRRR FFFFUUUUNNNNCCCCTTTTIIIIOOOONNNNSSSS
  211.    IIIInnnnhhhheeeerrrriiiitttteeeedddd ffffrrrroooommmm iiiillllSSSSeeeeppppKKKKeeeerrrrnnnneeeellll
  212.      getXdata(), getXelement(), getYdata(), getYelement(), getZdata(),
  213.      getZelement(), setXdata(), setXelement(), setYdata(), setYelement(),
  214.      setZdata(), setZelement()
  215.  
  216.    IIIInnnnhhhheeeerrrriiiitttteeeedddd ffffrrrroooommmm iiiillllKKKKeeeerrrrnnnneeeellll
  217.      calcGain(), calcPassGain(), copy(), getData(), getDataType(),
  218.      getElement(), getKernelType(), getOrigin(), getSize(), getVal(),
  219.      getXsize(), getYsize(), getZsize(), init(), isClampSet(), isEquivalent(),
  220.      offset(), offset(), operator=(), scale(), setClamp(), setData(),
  221.      setElement(), setOrigin(), setVal()
  222.  
  223.    IIIInnnnhhhheeeerrrriiiitttteeeedddd ffffrrrroooommmm iiiillllWWWWaaaattttcccchhhheeeeddddOOOObbbbjjjjeeeecccctttt
  224.      addWatchCallback(), doWatchCallbacks(), removeWatchCallback()
  225.  
  226. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  227.      ilWatchedObject, ilKernel, ilShapenKernel
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.                                                                         PPPPaaaaggggeeee 4444
  262.  
  263.  
  264.  
  265.